<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>媒体查询+Grid栅格</title>
    <style>
        div {
            text-align: center;
            background-color: paleturquoise;
            border-radius: 4px;
        }
        main {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            grid-gap: 20px;
        }
        @media (max-width: 768px) {
            main {
                grid-template-columns: repeat(2, 1fr);
            }
        }
        @media (max-width: 480px) {
            main {
                grid-template-columns: repeat(1, 1fr);
            }
        }
    </style>
</head>
<body>
    <main>
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
    </main>
</body>
</html>